home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Apple II Sample Code / APW.SC / SC17Darts / Darts.asm / UWindow.asm < prev   
Encoding:
Assembly Source File  |  1990-06-24  |  25.5 KB  |  982 lines  |  [TEXT/pdos]

  1. ***********************************************************************
  2. *
  3. * darts uwindow.asm -- Version 3.0 
  4. *
  5. * Copyright (c)
  6. * Apple Computer, Inc.  1986-1990
  7. * All Rights Reserved.
  8. *
  9. * Developer Technical Support Apple II Sample Code
  10. *
  11. * This file contains the code which implements  
  12. * windows in the program.
  13. *
  14. ***********************************************************************
  15.  
  16.                case on
  17.  
  18.                copy 2/ainclude/e16.types
  19.                copy 2/ainclude/e16.control
  20.                copy 2/ainclude/e16.list
  21.                copy 2/ainclude/e16.resources
  22.                copy darts.equ
  23.  
  24.                mcopy macros/uwindow.macros
  25.  
  26.                longi on
  27.                longa on
  28.  
  29. ***********************************************************************
  30. *
  31. * invalScore
  32. *
  33. * Invalidates a rectangle that holds the score for player one or two
  34. * so that it will be updated.
  35. *
  36. invalScore     start
  37.  
  38.                DefineStack
  39.  
  40. tempHndl       long                     ;Must be at 1,s
  41. wptr           long
  42.  
  43. saveDPage      word
  44. returnAddr     word
  45.  
  46. playerNum      word
  47.  
  48. ******************
  49.  
  50.                phd                      ;Save directPage register.
  51.                pha                      ;Make space for locals.
  52.                pha
  53.                pha
  54.                pha
  55.                tsc                      ;Set directPage register.
  56.                tcd
  57.  
  58.                PushLong theWindow       ;Result space is normally needed
  59.                ldx #6                   ;for this call.  The result will be
  60.                lda playerNum            ;placed in the local variable tempHndl.
  61.                bne aa
  62.                dex
  63. aa             phx
  64.                pea 0
  65.                _GetCtlHandleFromID      ;Result is in tempHndl.
  66.  
  67.                pha
  68.                pha
  69.                _GetPort
  70.                pla
  71.                sta wptr
  72.                pla
  73.                sta wptr+2
  74.                PushLong theWindow
  75.                _SetPort
  76.  
  77.                ldy #2                   ;Dereference tempHndl and add offset
  78.                lda [tempHndl],y         ;to ctlRect
  79.                tax
  80.                lda [tempHndl]
  81.                clc
  82.                adc #octlRect
  83.                bcc ab
  84.                inx
  85. ab             phx                      ;Pointer to rect to invalidate.
  86.                pha
  87.                _InvalRect
  88.  
  89.                pei wptr+2
  90.                pei wptr
  91.                _SetPort
  92.  
  93.                pla                      ;Remove local variable space.
  94.                pla
  95.                pla
  96.                pla
  97.                pld                      ;Restore directPage register.
  98.                plx                      ;Save return address.
  99.                pla                      ;Remove passed parameters.
  100.                phx                      ;Restore return address and return.
  101.                rts
  102.  
  103.                end
  104.  
  105. ***********************************************************************
  106. *
  107. * int2pstr
  108. *
  109. * Converts an integer into a decimal ascii string, left justified.
  110. * The string that this function is passed must be at least 7 bytes long.
  111. *
  112. int2pstr       start
  113.  
  114.                DefineStack
  115.  
  116. saveDPage      word
  117. returnAddr     word
  118.  
  119. str            long
  120. val            word
  121.  
  122. ******************
  123.  
  124.                phd                      ;Save directPage register.
  125.                tsc                      ;Set directPage register.
  126.                tcd
  127.  
  128.                pei val
  129.                lda str
  130.                ldx str+2
  131.                inc a
  132.                bne aa
  133.                inx
  134. aa             phx
  135.                pha
  136.                pea 6
  137.                pea 0
  138.                _Int2Dec                 ;It is now in the string, right justified.
  139.  
  140.                shortm                   ;Left justify it.
  141.                ldx #6
  142. outerLoop      ldy #1
  143.                lda [str],y
  144.                cmp #32
  145.                bne leftShifted
  146.                dex
  147. innerLoop      iny
  148.                lda [str],y
  149.                dey
  150.                sta [str],y
  151.                iny
  152.                cpy #6
  153.                bcc innerLoop
  154.                bra outerLoop
  155.  
  156. leftShifted    txa                      ;Here's how long it really is.
  157.                sta [str]
  158.                longm
  159.  
  160.                pld                      ;Restore directPage register.
  161.                plx                      ;Save return address.
  162.                pla                      ;Remove passed parameters.
  163.                pla
  164.                pla
  165.                phx                      ;Restore return address and return.
  166.                rts
  167.  
  168.                end
  169.  
  170. ***********************************************************************
  171. *
  172. * drawThisWindow -- called by the tools (jsl)
  173. *
  174. * Draws the window whose port is the current port.
  175. *
  176. drawThisWindow start
  177.  
  178.                DefineStack
  179.  
  180. tempRect       block 8
  181.  
  182. sizeLocals     EndLocals
  183.  
  184. saveDPage      word
  185. saveDBank      byte
  186. returnAddr     block 3
  187.  
  188. ******************
  189.  
  190.                phb                      ;We are called from the tools.
  191.                phk                      ;The dataBank may be wrong.
  192.                plb
  193.  
  194.                phd                      ;Save directPage register.
  195.                tsc                      ;Make space for locals.
  196.                sec
  197.                sbc #sizeLocals
  198.                tcs
  199.                tcd                      ;Set directPage register.
  200.  
  201.                lda #1
  202.                sta firstUpdateComplete
  203.                lda gameType
  204.                bne eitherGame
  205.  
  206.                tsc
  207.                clc
  208.                adc #tempRect            ;Where is this guy, anyway?
  209.                pea 0|-16                ;This one is for the PaintRect.
  210.                pha
  211.                pea 0|-16                ;This one is for the GetPortRect
  212.                pha
  213.                _GetPortRect
  214.  
  215.                lda tempRect+oh2         ;Dividing line for Robin game.
  216.                sec
  217.                sbc tempRect+oh1
  218.                lsr a
  219.                sta tempRect+oh1
  220.                inc a
  221.                inc a
  222.                sta tempRect+oh2
  223.                lda tempRect+ov1
  224.                clc
  225.                adc #15
  226.                sta tempRect+ov1
  227.                lda tempRect+ov2
  228.                sbc #18-1                ;Carry clear
  229.                sta tempRect+ov2
  230.                _PaintRect               ;Stack is normal again.
  231.  
  232. eitherGame     ldy #2
  233. loop           phy                      ;Keep index
  234.                lda score,y
  235.                pha                      ;Value to convert to string
  236.                tya
  237.                asl a
  238.                asl a                    ;*4, gives 8 or 0.
  239.                adc 3,s                  ;Add index, result is 10 or 0.
  240.                adc #scoreStrings
  241.                tax
  242.                lda #scoreStrings|-16
  243.                adc #0
  244.                pha                      ;String pointer.
  245.                phx
  246.                jsr int2pstr
  247.                ply
  248.                dey
  249.                dey
  250.                bpl loop
  251.  
  252.                PushLong #scoreStringArray
  253.                _SetCtlParamPtr
  254.  
  255.                PushLong theWindow
  256.                _DrawControls
  257.  
  258.                tsc                      ;Remove local variable space.
  259.                clc
  260.                adc #sizeLocals
  261.                tcs
  262.                pld                      ;Restore directPage register.
  263.                plb                      ;Restore dataBank register.
  264.                rtl
  265.  
  266.                end
  267.  
  268. ***********************************************************************
  269. *
  270. * drawListItem -- called by the tools (jsl)
  271. *
  272. * Draws the indicated list item.  
  273. *
  274. drawListItem   start
  275.  
  276.                DefineStack
  277.  
  278. theScore       word
  279. mode           word
  280. str            block 10
  281.  
  282. sizeLocals     EndLocals
  283.  
  284. saveDPage      word
  285. saveDBank      byte
  286. returnAddr     block 3
  287.  
  288. theListControl long
  289. myMemRecPtr    long
  290. rptr           long
  291.  
  292. ******************
  293.  
  294.                phb                      ;We are called from the tools.
  295.                phk                      ;The dataBank may be wrong.
  296.                plb
  297.  
  298.                phd                      ;Save directPage register.
  299.                tsc                      ;Make space for locals.
  300.                sec
  301.                sbc #sizeLocals
  302.                tcs
  303.                tcd                      ;Set directPage register.
  304.  
  305.                pha                      ;Remember mode, so we can switch.
  306.                _GetPenMode
  307.                pla
  308.                sta mode
  309.  
  310.                ldy #omemPtr
  311.                lda [myMemRecPtr],y
  312.                sta theScore             ;Score saved in lo-word of memRec ptr.
  313.  
  314.                ldy #omemFlag
  315.                lda [myMemRecPtr],y
  316.                and #$C0
  317.                cmp #$80
  318.                beq selected
  319.                pea $8000                ;Not selected pen mode.
  320.                _SetPenMode
  321.  
  322. selected       pei rptr+2
  323.                pei rptr
  324.                _PaintRect               ;Normal or inverse rectangle.
  325.  
  326.                pei mode
  327.                _SetPenMode
  328.  
  329.                tsc
  330.                clc
  331.                adc #str
  332.                pei theScore
  333.                pea 0|-16                ;Pointer to str
  334.                pha
  335.                jsr int2pstr
  336.  
  337.                ldy #oh1
  338.                lda [rptr],y
  339.                clc
  340.                adc #4
  341.                pha
  342.                iny
  343.                iny
  344.                lda [rptr],y
  345.                dec a
  346.                pha
  347.                _MoveTo
  348.  
  349.                pha
  350.                _GetTextMode
  351.                pla
  352.                sta mode
  353.  
  354.                pea $8002                ;Eor text mode, so works with selection.
  355.                _SetTextMode
  356.  
  357.                tsc
  358.                clc
  359.                adc #str
  360.                pea 0|-16
  361.                pha
  362.                _DrawString              ;Finally.
  363.  
  364.                pei mode
  365.                _SetTextMode
  366.  
  367.                tsc                      ;Remove local variable space.
  368.                clc
  369.                adc #sizeLocals
  370.                tcs
  371.                pld                      ;Restore directPage register.
  372.                ply                      ;Keep dataBank and return address.
  373.                plx
  374.                tsc                      ;Remove passed parameters.
  375.                clc
  376.                adc #12
  377.                tcs
  378.                phx                      ;Put dataBank and return address
  379.                phy                      ;back on the stack.
  380.                plb
  381.                rtl
  382.  
  383.                end
  384.  
  385. ***********************************************************************
  386. *
  387. * addToList
  388. *
  389. * Adds the indicated score to the right list.  
  390. *
  391. addToList      start
  392.  
  393.                DefineStack
  394.  
  395. theHndl        long                     ;Must be at 1,s
  396. topOfList      word
  397. numEntries     word
  398. memRecPtr      long
  399. size           word
  400. listHndl       long
  401. listPtr        long
  402. temp           word
  403.  
  404. sizeLocals     EndLocals
  405.  
  406. saveDPage      word
  407. returnAddr     word
  408.  
  409. amount         word
  410. playerNum      word
  411.  
  412. ******************
  413.  
  414.                phd                      ;Save directPage register.
  415.                tsc
  416.                sec
  417.                sbc #sizeLocals
  418.                tcs
  419.                tcd                      ;Set directPage register.
  420.  
  421.                lda playerNum
  422.                asl a
  423.                tax
  424.                inc listEntries,x
  425.                lda listEntries,x
  426.                sta numEntries           ;How many we will have after this one.
  427.                sec
  428.                sbc #3
  429.                bmi aa
  430.                bne ab
  431. aa             lda #1
  432. ab             sta topOfList
  433.  
  434.                lda numEntries           ;size = numEntries * 6
  435.                asl a
  436.                adc numEntries
  437.                asl a
  438.                sta size
  439.  
  440.                pha                      ;Result space.
  441.                pha
  442.                lda playerNum
  443.                asl a
  444.                asl a
  445.                tay
  446.                lda scoreList+2,y
  447.                sta listHndl+2
  448.                pha
  449.                lda scoreList,y
  450.                sta listHndl
  451.                pha
  452.                _GetHandleSize
  453.                pla
  454.                plx
  455.                cmp size
  456.                bcs bigEnough            ;List handle is big enough still.
  457.  
  458.                pea 0|-16
  459.                lda size
  460.                clc
  461.                adc #100
  462.                pha
  463.                pei listHndl+2
  464.                pei listHndl
  465.                _SetHandleSize           ;Now it is big enough.
  466.  
  467. bigEnough      pei listHndl+2           ;Dereference to list element.
  468.                pei listHndl
  469.                lda numEntries
  470.                dec a
  471.                pha
  472.                jsr indexIntoListHndl
  473.                sta listPtr
  474.                stx listPtr+2
  475.  
  476.                ldy #omemPtr             ;Save data into list.
  477.                lda amount
  478.                sta [listPtr],y
  479.                ldy #omemFlag
  480.                lda #0
  481.                sta [listPtr],y
  482.  
  483.                PushLong theWindow       ;Result space is normally needed
  484.                ldx #4                   ;for this call.  The result will be
  485.                lda playerNum            ;placed in the local variable theHndl.
  486.                bne ad
  487.                dex
  488. ad             phx
  489.                pea 0
  490.                _GetCtlHandleFromID      ;Result is in theHndl.
  491.  
  492.                PushLong #drawListItem
  493.                pei topOfList
  494.                pei listHndl+2
  495.                pei listHndl
  496.                pea refIsHandle
  497.                pei numEntries
  498.                pei theHndl+2
  499.                pei theHndl
  500.                _NewList2                ;Tell the world about the list update.
  501.  
  502.                tsc                      ;Remove local variable space.
  503.                clc
  504.                adc #sizeLocals
  505.                tcs
  506.                pld                      ;Restore directPage register.
  507.                plx                      ;Save return address.
  508.                pla                      ;Remove passed parameters.
  509.                pla
  510.                phx                      ;Restore return address and return.
  511.                rts
  512.  
  513.                end
  514.  
  515.  
  516.  
  517. indexIntoListHndl start
  518.  
  519.                DefineStack
  520.  
  521. saveDPage      word
  522. returnAddr     word
  523.  
  524. index          word
  525. listHndl       long
  526.  
  527.                phd                      ;Save directPage register.
  528.                tsc
  529.                tcd
  530.  
  531.                ldy #2
  532.                lda [listHndl],y
  533.                tax
  534.                lda index
  535.                asl a
  536.                adc index
  537.                asl a
  538.                adc [listHndl]
  539.                bcc aa
  540.                inx
  541.  
  542. aa             ldy returnAddr           ;Move return address.
  543.                sty listHndl+2
  544.                pld                      ;Restore directPage register.
  545.                ply                      ;Remove passed parameters
  546.                ply
  547.                ply
  548.                rts
  549.  
  550.                end
  551.  
  552. ***********************************************************************
  553. *
  554. * fixButtonTitle
  555. *
  556. * This routine is called only when the chosen game is crickett.  Its job
  557. * is to adjust the button title of the button associated with the amount
  558. * passed.
  559. *
  560. * There are four possible states of the button title.  Which state it is
  561. * in depends on the number times it has been pressed (contained in the
  562. * CrickettTables).
  563. *
  564. fixButtonTitle start
  565.  
  566.                DefineStack
  567.  
  568. theHndl        long                     ;Must be at 1,s
  569.  
  570. saveDPage      word
  571. returnAddr     word
  572.  
  573. amount         word
  574. playerNum      word
  575.  
  576. ******************
  577.  
  578.                phd                      ;Save directPage register.
  579.                pha
  580.                pha                      ;Make space for locals.
  581.                tsc                      ;Set directPage register.
  582.                tcd
  583.  
  584.                lda amount               ;Figure the correct ID.
  585.                ldx playerNum
  586.                cpx #Player1
  587.                beq aa
  588.                ora #$8000
  589. aa             ldx theWindow+2          ;theHndl will act as the result space.
  590.                phx
  591.                ldx theWindow
  592.                phx
  593.                pea 0|-16
  594.                pha
  595.                _GetCtlHandleFromID      ;Result now in theHndl.
  596.  
  597.                pei playerNum            ;Get crickettTables hit value.
  598.                pei amount
  599.                jsr getCTval
  600.                cmp #4
  601.                bcs noChange
  602.  
  603.                pea titleTbl|-16         ;Point to a title string.
  604.                asl a                    ;There can't be a carry, since
  605.                adc #titleTbl            ;we are pointing into a code bank.
  606.                pha
  607.                pei theHndl+2
  608.                pei theHndl
  609.                _SetCtlTitle
  610.  
  611. noChange       anop
  612.                pla                      ;Remove local variable space.
  613.                pla
  614.                pld                      ;Restore directPage register.
  615.                plx                      ;Save return address.
  616.                pla                      ;Remove passed parameters.
  617.                pla
  618.                phx                      ;Restore return address and return.
  619.                rts
  620.  
  621. titleTbl       dc i1'1'
  622.                dc c' '
  623.                dc i1'1'
  624.                dc c'/'
  625.                dc i1'1'
  626.                dc c'X'
  627.                dc i1'1'
  628.                dc c'*'
  629.  
  630.                end
  631.  
  632. ***********************************************************************
  633. *
  634. * removeSelected
  635. *
  636. * Removes any selected scores from the list.
  637. *
  638. removeSelected start
  639.  
  640.                DefineStack
  641.  
  642. theHndl        long                     ;Must be at 1,s
  643. itemToRemove   word
  644. amount         word
  645. topOfList      word
  646. size           word
  647. listHndl       long
  648. listPtr        long
  649.  
  650. sizeLocals     EndLocals
  651.  
  652. saveDPage      word
  653. returnAddr     word
  654.  
  655. playerNum      word
  656.  
  657. ******************
  658.  
  659.                phd                      ;Save directPage register.
  660.                tsc
  661.                sec
  662.                sbc #sizeLocals
  663.                tcs
  664.                tcd                      ;Set directPage register.
  665.  
  666.                PushLong theWindow
  667.                ldx #4                   ;theHndl will act as result space.
  668.                lda playerNum
  669.                bne aa
  670.                dex
  671. aa             phx
  672.                pea 0
  673.                _GetCtlHandleFromID      ;Result now in theHndl.
  674.  
  675. loopAway       pha                      ;Delete as many as are selected.
  676.                pea 0
  677.                pei theHndl+2
  678.                pei theHndl
  679.                _NextMember2
  680.                pla
  681.                sta itemToRemove
  682.                bne ab
  683.                brl inval
  684.  
  685. ab             lda playerNum
  686.                asl a
  687.                asl a
  688.                tay
  689.                lda scoreList+2,y
  690.                sta listHndl+2
  691.                pha
  692.                lda scoreList,y
  693.                sta listHndl
  694.                pha
  695.                lda itemToRemove
  696.                dec a
  697.                pha
  698.                jsr indexIntoListHndl
  699.                sta listPtr
  700.                stx listPtr+2            ;We are pointing at the one to go.
  701.  
  702.                lda [listPtr]            ;This is how many points it is.
  703.                sta amount
  704.  
  705.                lda gameType
  706.                bne crickett
  707.                lda playerNum            ;Simple subtract for Robin game.
  708.                asl a
  709.                tax
  710.                lda score,x
  711.                sec
  712.                sbc amount
  713.                sta score,x
  714.                bra eitherGame
  715.  
  716. crickett       pei playerNum            ;Complicated subtract for crickett.
  717.                pei amount
  718.                jsr getCTval
  719.                cmp #4
  720.                bcc noSubtract
  721.                lda playerNum
  722.                asl a
  723.                tax
  724.                lda score,x
  725.                sec
  726.                sbc amount
  727.                sta score,x
  728. noSubtract     tyx                      ;YREG calculated by getCTval
  729.                dec crickettTables,x
  730.                pei playerNum
  731.                pei amount
  732.                jsr fixButtonTitle
  733.  
  734. eitherGame     pei listHndl+2           ;Re-dereference -- might have moved.
  735.                pei listHndl
  736.                lda itemToRemove
  737.                dec a
  738.                pha
  739.                jsr indexIntoListHndl
  740.                sta listPtr
  741.                stx listPtr+2
  742.  
  743.                lda playerNum
  744.                asl a
  745.                tax
  746.                lda listEntries,x
  747.                dec listEntries,x        ;We will have 1 fewer soon.
  748.                sec
  749.                sbc itemToRemove
  750.                sta size
  751.                asl a
  752.                adc size
  753.                asl a
  754.                sta size
  755.  
  756.                lda listPtr              ;Do a BlockMove to delete it.
  757.                ldx listPtr+2
  758.                clc
  759.                adc #6
  760.                bcc ac
  761.                inx
  762. ac             phx
  763.                pha
  764.                pei listPtr+2
  765.                pei listPtr
  766.                pea 0|-16
  767.                pei size
  768.                _BlockMove
  769.  
  770.                pha
  771.                pei theHndl+2
  772.                pei theHndl
  773.                _GetCtlValue
  774.                pla
  775.                dec a
  776.                bmi fixit
  777.                bne ok
  778. fixit          lda #1
  779. ok             sta topOfList
  780.  
  781.                PushLong #drawListItem
  782.                pei topOfList
  783.                pei listHndl+2
  784.                pei listHndl
  785.                pea refIsHandle
  786.                lda playerNum
  787.                asl a
  788.                tax
  789.                lda listEntries,x
  790.                pha
  791.                pei theHndl+2
  792.                pei theHndl
  793.                _NewList2                ;Let the tools know something changed.
  794.  
  795.                brl loopAway
  796.  
  797. inval          pei playerNum            ;Update score on screen.
  798.                jsr invalScore
  799.  
  800.                tsc                      ;Remove local variable space.
  801.                clc
  802.                adc #sizeLocals
  803.                tcs
  804.                pld                      ;Restore directPage register.
  805.                plx                      ;Save return address.
  806.                pla                      ;Remove passed parameters.
  807.                phx                      ;Restore return address and return.
  808.                rts
  809.  
  810.                end
  811.  
  812. ***********************************************************************
  813. *
  814. * clearList
  815. *
  816. * Clears the indicated list.  
  817. *
  818. clearList      start
  819.  
  820.                DefineStack
  821.  
  822. theHndl        long                     ;Must be at 1,s
  823.  
  824. saveDPage      word
  825. returnAddr     word
  826.  
  827. playerNum      word
  828.  
  829. ******************
  830.  
  831.                phd                      ;Save directPage register.
  832.                pha                      ;Make space for locals.
  833.                pha
  834.                tsc                      ;Set directPage register.
  835.                tcd
  836.  
  837.                PushLong theWindow
  838.                ldx #4
  839.                lda playerNum
  840.                bne aa
  841.                dex
  842. aa             phx
  843.                pea 0
  844.                _GetCtlHandleFromID
  845.  
  846.                lda playerNum
  847.                asl a
  848.                tax
  849.                lda #0
  850.                sta listEntries,x
  851.  
  852.                PushLong #drawListItem
  853.                pea 0                    ;Item to display
  854.                txa
  855.                asl a
  856.                tax
  857.                lda scoreList+2,x
  858.                pha
  859.                lda scoreList,x
  860.                pha
  861.                pea refIsHandle
  862.                pea 0                    ;Number of items
  863.                pei theHndl+2
  864.                pei theHndl
  865.                _NewList2
  866.  
  867.                pla                      ;Remove local variable space.
  868.                pla
  869.                pld                      ;Restore directPage register.
  870.                plx                      ;Save return address.
  871.                pla                      ;Remove passed parameters.
  872.                phx                      ;Restore return address and return.
  873.                rts
  874.  
  875.                end
  876.  
  877. ***********************************************************************
  878. *
  879. * startUpRobinGame
  880. *
  881. * Opens the robin game window and zeros the scores.
  882. *
  883. startupRobinGame start
  884.  
  885.                pha
  886.                pha
  887.                PushLong #0
  888.                PushLong #0
  889.                PushLong #drawThisWindow
  890.                PushLong #0
  891.                pea refIsResource
  892.                PushLong #RobinWindow
  893.                pea rWindParam1
  894.                _NewWindow2
  895.                pla
  896.                sta theWindow
  897.                pla
  898.                sta theWindow+2
  899.  
  900.                lda #0
  901.                sta listEntries
  902.                sta listEntries+2
  903.  
  904.                rts
  905.  
  906.                end
  907.  
  908. ***********************************************************************
  909. *
  910. * startupCrickettGame
  911. *
  912. * Opens the crickett game window and zeros the scores.
  913. *
  914. startupCrickettGame start
  915.  
  916.                pha
  917.                pha
  918.                PushLong #0
  919.                PushLong #0
  920.                PushLong #drawThisWindow
  921.                PushLong #0
  922.                pea refIsResource
  923.                PushLong #CrickettWindow
  924.                pea rWindParam1
  925.                _NewWindow2
  926.                pla
  927.                sta theWindow
  928.                pla
  929.                sta theWindow+2
  930.  
  931.                lda #0
  932.                sta listEntries
  933.                sta listEntries+2
  934.                sta weHaveAWinner
  935.  
  936.                rts
  937.  
  938.                end
  939.  
  940. ***********************************************************************
  941. *
  942. * setupWindows
  943. *
  944. * Inits any of the window unit variables we need to start up 
  945. * the game.  Calls the routine that opens the first window.
  946. *
  947. setupWindows   start
  948.  
  949.                ldy #4
  950. loop           phy
  951.                pha
  952.                pha
  953.                PushLong #500
  954.                lda userID
  955.                pha
  956.                pea 0
  957.                PushLong #0
  958.                _NewHandle
  959.                pla
  960.                plx
  961.                ply
  962.                sta scoreList,y
  963.                txa
  964.                sta scoreList+2,y
  965.                dey
  966.                dey
  967.                dey
  968.                dey
  969.                bpl loop
  970.  
  971.                lda #0
  972.                sta firstUpdateComplete
  973.                sta listEntries
  974.                sta listEntries+2
  975.  
  976.                jsr startupRobinGame
  977.                rts
  978.  
  979.                end
  980.  
  981.                END
  982.